<%-- 
    Document   : ajoutActeur
    Created on : 24 mai 2010, 17:19:48
    Author     : coralie
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

 <%@page import="java.lang.String"%>
 <%@page import="java.util.List"%>
 <%@page import="java.util.Set" %>
 <%@page import="java.util.HashSet" %>
 <%@page import="java.util.Iterator"%>
 <%@page import="ClassPackage.*" %>
 <%@page  import="org.hibernate.HibernateException" %>
 <%@page  import="org.hibernate.SessionFactory" %>
 <%@page import="org.hibernate.Session" %>

 <jsp:useBean id="act" class="ClassPackage.Personne" scope  = "request"/>
 <jsp:useBean id="film" class="ClassPackage.Film" scope  = "request"/>

  <% List Mylst =(List)request.getAttribute("ListePersonne") ;
     Mylst.addAll(act.getListPersonne( (SessionFactory)request.getAttribute("SessionFact"),(String)request.getAttribute("name")));
  %>
  <% 
      Session hib = ((SessionFactory)request.getAttribute("SessionFact")).getCurrentSession();
      hib.getTransaction().begin();
    /*  String t =(String)request.getAttribute("Film_ID");
      film =(Film)hib.get(Film.class,Integer.parseInt(t)); */
      Set Actorlst = new HashSet();// film.getActor();
      Set Directorlst =new HashSet();// film.getDirector();
  %>
     
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>VOD World</title>
        <link rel=stylesheet type="text/css" href="style.css">
</head>
    <body>
        <div id="container">

            <%@ include file="header.jsp"%>

            <div id="main">
               
                        <label  for="nom">Nom personne : </label><br>
 
                        <form id="recherche" action="ControlerServlet">
                            <input type="hidden" name="ID_FILM" value="<% out.println(request.getAttribute("Film_ID"));%>" />
                            <input type="text" name="name" value="none"/>
                            <input type="hidden" name="Operation" value="250"/>
                            <input type="submit" name="search" value="Search" /><br>
                        </form> 
                        
                        <form id="ajout" class="cssform" action="ControlerServlet" >
                            <input type="hidden" name="ID_FILM" value="<% out.println(request.getAttribute("Film_ID"));%>" />

                          <p><p><br>
                              <label  for="nom">Liste personnes : </label><br>
                            <select name="personnes" size="3">
                             <% Iterator it = Mylst.iterator();
                                while(it.hasNext())
                                  {act = (Personne)it.next(); %>
                                <option value="<% out.println(act.getID());%>"><% out.println(act.getName()+" "+act.getLastName());%></option>
                                <%}%>
                            </select><p><br>
                            <input type="hidden" name="Operation" value="400">
                            <input type="hidden" name="param_name" value="<%out.println(request.getAttribute("Param_name"));%>"
                            <INPUT TYPE=RADIO NAME="choix" VALUE="A" checked="true">Acteur<BR>
                            <INPUT TYPE=RADIO NAME="choix" VALUE="R" checked="false">Realisateur<br>
                            <input type="submit" name="Ajout" value="Ajout"/><br>
                            
                      
                        
                        </form>
                        <p><p><br>
                            <label  style="float: left">Acteurs ajoutés : </label><label style="margin-left: 200px">Réalisateurs ajoutés : </label><br>
                            <select name="acteur" size="3" style="float: left">
                            
                        <% it = Actorlst.iterator();
                                while(it.hasNext())
                                  {act = (Personne)it.next(); %>
                                <option value="<% out.println(act.getID());%>"><% out.println(act.getName()+" "+act.getLastName());%></option>
                                <%}%>
                            </select>
                        

                            <select name="realisateur" size="3" style="margin-left: 200px">
                        <% it = Directorlst.iterator();
                                while(it.hasNext())
                                  {act = (Personne)it.next(); %>
                                <option value="<% out.println(act.getID());%>"><% out.println(act.getName()+" "+act.getLastName());%></option>
                                <%}%>
                            </select><br>
                        </p>
                        <div style="margin-left: 150px;"><br>
                         
                        </div>
                        
            </div>

            <div id="footer">
                Site fait par Yves Derkac et Coralie Vessières
            </div>

        </div>

    </body>
</html>